<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Light-UI DiaLog（弹窗）组件 | 靓仔UI</title>
    <meta name="description" content="">
    <script src="https://cdn.jsdelivr.net/npm/react/umd/react.production.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/react-dom/umd/react-dom.production.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/@babel/standalone/babel.min.js"></script>
  <link rel="manifest" href="/light-ui-docs/manifest.json">
  <link rel="apple-touch-icon" href="/light-ui-docs/favicon.ico">
    
    <link rel="preload" href="/light-ui-docs/assets/css/0.styles.8e0e800c.css" as="style"><link rel="preload" href="/light-ui-docs/assets/js/app.dc71ef51.js" as="script"><link rel="preload" href="/light-ui-docs/assets/js/2.f52b28ca.js" as="script"><link rel="preload" href="/light-ui-docs/assets/js/10.c0615296.js" as="script"><link rel="prefetch" href="/light-ui-docs/assets/js/11.0b0f98b1.js"><link rel="prefetch" href="/light-ui-docs/assets/js/12.2cf92493.js"><link rel="prefetch" href="/light-ui-docs/assets/js/13.ad660a05.js"><link rel="prefetch" href="/light-ui-docs/assets/js/14.411fe07d.js"><link rel="prefetch" href="/light-ui-docs/assets/js/15.cdf0bf8f.js"><link rel="prefetch" href="/light-ui-docs/assets/js/3.2b5dff7c.js"><link rel="prefetch" href="/light-ui-docs/assets/js/4.795a5898.js"><link rel="prefetch" href="/light-ui-docs/assets/js/5.3c374e65.js"><link rel="prefetch" href="/light-ui-docs/assets/js/6.a99998f4.js"><link rel="prefetch" href="/light-ui-docs/assets/js/7.2187110b.js"><link rel="prefetch" href="/light-ui-docs/assets/js/8.560f863e.js"><link rel="prefetch" href="/light-ui-docs/assets/js/9.1cf0d6f8.js">
    <link rel="stylesheet" href="/light-ui-docs/assets/css/0.styles.8e0e800c.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/light-ui-docs/" class="home-link router-link-active"><!----> <span class="site-name">靓仔UI</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/light-ui-docs/" class="nav-link">首页</a></div><div class="nav-item"><a href="https://gitee.com/caohuiboss" target="_blank" rel="noopener noreferrer" class="nav-link external">
  码云
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="https://cn.bing.com/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  必应
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/light-ui-docs/" class="nav-link">首页</a></div><div class="nav-item"><a href="https://gitee.com/caohuiboss" target="_blank" rel="noopener noreferrer" class="nav-link external">
  码云
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="https://cn.bing.com/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  必应
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav>  <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>靓仔UI</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/light-ui-docs/light-ui/ICON-图标.html" class="sidebar-link">Light-UI icon 字体图标参考</a></li><li><a href="/light-ui-docs/light-ui/Button-按钮.html" class="sidebar-link">Light-UI 按钮组件</a></li><li><a href="/light-ui-docs/light-ui/Card-卡片.html" class="sidebar-link">Light-UI Card (卡片) 组件</a></li><li><a href="/light-ui-docs/light-ui/Dialog-弹窗.html" class="active sidebar-link">Light-UI DiaLog（弹窗）组件</a></li><li><a href="/light-ui-docs/light-ui/Input-输入框.html" class="sidebar-link">Light-UI Input (输入框) 组件</a></li><li><a href="/light-ui-docs/light-ui/Layout-布局.html" class="sidebar-link">Light-UI layout (布局) 组件</a></li><li><a href="/light-ui-docs/light-ui/Tag-标签.html" class="sidebar-link">Light-UI Tag标签组件</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="（弹窗）组件"><a href="#（弹窗）组件" class="header-anchor">#</a> （弹窗）组件</h1> <blockquote><p>只是一个很简单的模态框</p></blockquote> <div data-config="" data-type="vue" data-code="%3Ctemplate%3E%0A%20%20%3Cdiv%20class%3D%22box-vue%22%3E%0A%20%20%20%20%3CButton%20type%3D%22primary%22%20%40click%3D%22dialog%20%3D%20true%22%3E%E6%89%93%E5%BC%80%E5%BC%B9%E7%AA%97%3C%2FButton%3E%0A%20%20%20%20%3CDialog%20%3Avisible.sync%3D%22dialog%22%3E%0A%20%20%20%20%20%20%3Cdiv%20slot%3D%22header%22%3E%0A%20%20%20%20%20%20%20%20%E6%A0%87%E9%A2%98%0A%20%20%20%20%20%20%3C%2Fdiv%3E%0A%20%20%20%20%20%20%3Cdiv%3E%0A%20%20%20%20%20%20%20%20%E5%86%85%E5%AE%B9%0A%20%20%20%20%20%20%3C%2Fdiv%3E%0A%20%20%20%20%20%20%3Cdiv%20slot%3D%22footer%22%3E%0A%20%20%20%20%20%20%20%20%3CButton%20%40click%3D%22close%22%3E%E4%B8%BB%E8%A6%81%E6%8C%89%E9%92%AE%3C%2FButton%3E%0A%20%20%20%20%20%20%20%20%3CButton%20%40click%3D%22close%22%3E%E4%B8%BB%E8%A6%81%E6%8C%89%E9%92%AE%3C%2FButton%3E%0A%20%20%20%20%20%20%3C%2Fdiv%3E%0A%20%20%20%20%3C%2FDialog%3E%0A%20%20%3C%2Fdiv%3E%0A%3C%2Ftemplate%3E%0A%3Cscript%3E%0Aexport%20default%20%7B%0A%20%20data%3A%20()%20%3D%3E%20(%7Bdialog%3A%20false%7D)%2C%0A%20%20methods%3A%20%7B%0A%20%20%20%20close()%20%7B%0A%20%20%20%20%20%20this.dialog%20%3D%20false%3B%0A%20%20%20%20%7D%2C%0A%20%20%7D%0A%7D%0A%3C%2Fscript%3E%20%0A%3Cstyle%3E%0A.box-vue%20%3E%20.li-button%20%7B%0A%20%20%20%20margin%3A%204px%3B%0A%7D%0A%3C%2Fstyle%3E%20%0A" class="vuepress-plugin-demo-block__wrapper" style="display:none;"><div class="vuepress-plugin-demo-block__display"><div class="vuepress-plugin-demo-block__app"></div></div> <div class="vuepress-plugin-demo-block__code"><div class="language-html line-numbers-mode"><pre class="language-html"><code><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>template</span><span class="token punctuation">&gt;</span></span>
  <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>box-vue<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>Button</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>primary<span class="token punctuation">&quot;</span></span> <span class="token attr-name">@click</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>dialog = true<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>打开弹窗<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>Button</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>Dialog</span> <span class="token attr-name">:visible.sync</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>dialog<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">slot</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>header<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
        标题
      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span><span class="token punctuation">&gt;</span></span>
        内容
      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">slot</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>footer<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>Button</span> <span class="token attr-name">@click</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>close<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>主要按钮<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>Button</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>Button</span> <span class="token attr-name">@click</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">&quot;</span>close<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>主要按钮<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>Button</span><span class="token punctuation">&gt;</span></span>
      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>Dialog</span><span class="token punctuation">&gt;</span></span>
  <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>template</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>script</span><span class="token punctuation">&gt;</span></span><span class="token script"><span class="token language-javascript">
<span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token punctuation">{</span>
  <span class="token function-variable function">data</span><span class="token punctuation">:</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">(</span><span class="token punctuation">{</span>dialog<span class="token punctuation">:</span> <span class="token boolean">false</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
  methods<span class="token punctuation">:</span> <span class="token punctuation">{</span>
    <span class="token function">close</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span>dialog <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>script</span><span class="token punctuation">&gt;</span></span> 
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>style</span><span class="token punctuation">&gt;</span></span><span class="token style"><span class="token language-css">
<span class="token selector">.box-vue &gt; .li-button</span> <span class="token punctuation">{</span>
    <span class="token property">margin</span><span class="token punctuation">:</span> 4px<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>style</span><span class="token punctuation">&gt;</span></span> 
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br></div></div></div> <div class="vuepress-plugin-demo-block__footer"></div></div></div> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">Last Updated:</span> <span class="time">4/27/2020, 9:28:04 PM</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/light-ui-docs/light-ui/Card-卡片.html" class="prev">Light-UI Card (卡片) 组件</a></span> <span class="next"><a href="/light-ui-docs/light-ui/Input-输入框.html">Light-UI Input (输入框) 组件</a>
      →
    </span></p></div> </main></div><div class="global-ui"></div></div>
    <script src="/light-ui-docs/assets/js/app.dc71ef51.js" defer></script><script src="/light-ui-docs/assets/js/2.f52b28ca.js" defer></script><script src="/light-ui-docs/assets/js/10.c0615296.js" defer></script>
  </body>
</html>
